using System;
using System.Collections.Generic;
using System.Text;
using System.CodeDom.Compiler;

namespace SharpMud.Server.Systems.Scripting.Processing.Metadata
{
    internal class PreparedCodeContainer : IEquatable<PreparedCodeContainer>
    {
        public PreparedCodeContainer(Guid originalCodeHash, string preparedCode, CodeDomProvider compiler)
        {
            OriginalCodeHash = originalCodeHash;
            PreparedCode = preparedCode;
            Compiler = compiler;
        }

        public Guid OriginalCodeHash;
        public string PreparedCode;
        public CodeDomProvider Compiler;

        #region IEquatable<PreparedCodeContainer> Members

        public bool Equals(PreparedCodeContainer other)
        {
            if (this.OriginalCodeHash != Guid.Empty && other.OriginalCodeHash != Guid.Empty && this.OriginalCodeHash != other.OriginalCodeHash)
            {
                return false;
            }
            else if (this.OriginalCodeHash == Guid.Empty || other.OriginalCodeHash == Guid.Empty)
            {
                return false;
            }
            else
            {
                return true;
            }

        }

        #endregion
    }
}
